<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
    <title><?php echo CHtml::encode($this->pageTitle); ?></title>

	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
	<meta name="language" content="en" />
    <meta name="google-site-verification" content="<?php echo GOOGLE_ANALYTICS_VERIFY; ?>" />
    <script>
        (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
            (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
            m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
        })(window,document,'script','//www.google-analytics.com/analytics.js','ga');

        ga('create', '<?php echo GA_CODE; ?>', "<?php echo $_SERVER['SERVER_NAME'] ?>");
        ga('send', 'pageview');

    </script>
</head>

<body>

<div class="container" id="page">

	<div id="header">
		<div id="logo"><?php echo CHtml::encode(Yii::app()->name); ?></div>
	</div><!-- header -->

	<div id="mainmenu">
		<?php $this->widget('zii.widgets.CMenu',array(
			'items'=>array(
				array('label'=>'Home', 'url'=>array('/site/index'), 'linkOptions' => array('title' => 'Home')),
				array('label'=>'About', 'url'=>array('/site/page', 'view'=>'about')),
				array('label'=>'Contact', 'url'=>array('/site/contact')),
				array('label'=>'Register', 'url'=>array('/site/register'), 'visible' => Yii::app()->user->isGuest),
                array('label' => 'Admin', 'url' => '/?r=Admin', 'visible' => Helper::user()->checkAccess('Super') || Helper::user()->checkAccess('Administrators')),
				array('label'=>'Profile', 'url'=>array('/site/profile', 'username' => Helper::user()->getName()), 'visible'=> !Yii::app()->user->isGuest),
				array('label'=>'Login', 'url'=>array('/site/login'), 'visible'=>Yii::app()->user->isGuest),
				array('label'=>'Logout ('.Yii::app()->user->name.')', 'url'=>array('/site/logout'), 'visible'=>!Yii::app()->user->isGuest)
			),
		)); ?>
	</div><!-- mainmenu -->

	<?php $this->widget('zii.widgets.CBreadcrumbs', array(
		'links'=>$this->breadcrumbs,
	)); ?><!-- breadcrumbs -->

    <div id="content">
	    <?php echo $content; ?>
    </div>
    <div class="clearfix"></div>

	<div id="footer">
        <div class="statUser">
            online: <?php echo Yii::app()->counter->getOnline(); ?><br />
            today: <?php echo Yii::app()->counter->getToday(); ?><br />
            yesterday: <?php echo Yii::app()->counter->getYesterday(); ?><br />
            total: <?php echo Yii::app()->counter->getTotal(); ?><br />
            maximum: <?php echo Yii::app()->counter->getMaximal(); ?><br />
            date for maximum: <?php echo date('d.m.Y', Yii::app()->counter->getMaximalTime()); ?>
        </div>
		Copyright &copy; <?php echo date('Y'); ?> by My Company.<br/>
		All Rights Reserved.<br/>
		<?php echo Yii::powered(); ?>
	</div><!-- footer -->

</div><!-- page -->

<!-- CSS -->
<!-- blueprint CSS framework -->
<?php $am = Yii::app()->assetManager; ?>
<?php Helper::cs()->registerCssFile( $am->publish(Yii::getPathOfAlias( 'webroot' ) . Helper::themeUrl() . '/css/styles.css', 'screen') ); ?>

<!-- JS -->
<?php Helper::cs()->registerCoreScript('jquery'); ?>
<?php Helper::cs()->registerCoreScript('jquery.ui'); ?>
<?php Helper::cs()->registerScriptFile( $am->publish(Yii::getPathOfAlias( 'webroot' ) . Helper::themeUrl() . "/js/all.min.js", CClientScript::POS_END) ) ;?>
<?php $scriptJSMainPage = '
$.fn.followTo = function (name, pos, width) {
        var $this = this,
            $window = $(window);

        $window.scroll(function (e) {
            if ($window.scrollTop() > pos) {
                if (name == "yahoo") {
                    $this.css({
                        width: width,
                        position: "fixed",
                        bottom: 25
//                        right: 10
                    });
                } else {
                    $this.css({
                        width: width,
                        position: "fixed",
                        bottom: 45,
                        left: 10
                    })
                }
            } else {
                $this.css({
                    position: "relative",
                    bottom: 0
                })
            }
        });
    };
$(function() {
        /* scroll to top*/
        $(window).scroll(function(){
            if ($(this).scrollTop() > 100) {
                $(".scrollup").fadeIn();
            } else {
                $(".scrollup").fadeOut();
            }
        });

        /* imgLiquid */
        $(".product-list .sixcol .imgLiquid").css({
            width: "100%",
            height: "210px"
        })
        $(".product-list .fourcol .imgLiquid").css({
            width: "100%",
            height: "172px"
        })
        $(".advertise.banner .imgLiquid").css({
            width: "100%",
            height: "150px"
        })
        $(".advertise .item .banner .imgLiquid").css({
            width: "100%",
            height: "250px"
        })
        $(".ingredient .imgLiquid").css({
            width: "150px",
            height: "112px",
            margin: "0 10px 0 0",
            float: "left"
        })
        $(".imgLiquid").imgLiquid({
            fill: false,
            horizontalAlign: "left"
        });

        $(".imgLiquid.forProduct, .imgLiquid.forBanner, .imgLiquid.forPopular").imgLiquid({
            fill: false,
            horizontalAlign: "center"
        });

        /* scrollup */
        $(".scrollup").click(function(){
            $("html, body").animate({ scrollTop: 0 }, 600);
            return false;
        });

        /* add cart */
        $(".add-cart").click(function() {
            var url = "' . Helper::url("/Shop/product/updateOrDeleteCart") . '";
            var $this = $(this);
            var productAlias = $this.attr("id").replace("id-", "");

            param = {
                category: "' . Helper::get("category") . '",
                alias: productAlias,
                quantity: 1,
                valueBefore: 0,
                totalValueBefore: 0,
                type: "addCart"
            };

            processAjax(url, param, $this, productAlias, "addCart");

            return false;
        })

        /* followTo */
        $(".yahoo").followTo("yahoo", 150, 125)
        $(".cart").followTo("cart", 650, 650)

        /* add active class while hover menu */
        $(".menu-categories a").hover(function() {
            $(this).addClass("active");
        }).mouseout(function() {
                $(this).removeClass("active");
            })

        // nivoSlider
        $("#slider").nivoSlider({
            effect: "random", /* Specify sets like: "fold,fade,sliceDown" */
            slices: 15, // For slice animations
            boxCols: 8, // For box animations
            boxRows: 4, // For box animations
            animSpeed: 500, // Slide transition speed
            pauseTime: 3000, // How long each slide will show
            startSlide: 0, // Set starting Slide (0 index)
            directionNav: true, // Next & Prev navigation
            controlNav: true, // 1,2,3... navigation
            controlNavThumbs: false, // Use thumbnails for Control Nav
            pauseOnHover: true, // Stop animation while hovering
            manualAdvance: false, // Force manual transitions
            prevText: "Prev", // Prev directionNav text
            nextText: "Next", // Next directionNav text
            randomStart: false, // Start on a random slide
            beforeChange: function(){}, // Triggers before a slide transition
            afterChange: function(){}, // Triggers after a slide transition
            slideshowEnd: function(){}, // Triggers after all slides have been shown
            lastSlide: function(){}, // Triggers when last slide is shown
            afterLoad: function(){} // Triggers when slider has loaded
        });
    })
';
Helper::cs()->registerScript('scriptJSMainPage', $scriptJSMainPage,CClientScript::POS_END);
?>
</body>
</html>
